<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../js/ajax.js"></script>
		<script src="../js/back.js" type="text/javascript"></script>
		<script src="../js/back1.js" type="text/javascript"></script>
		<style type="text/css">
			img{width:100px;height:100px}
		</style>
	</head>
	<body>
		<div id="app">
			<van-nav-bar title="用户登录" @click-left="onback1" left-arrow>
			</van-nav-bar>
			<van-cell-group>
				<van-cell center=true style="padding-left:30% ;">
					<img src="../img/001.jpg" style="border-radius: 50%;" />
				</van-cell>
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="phone" label="手机号" placeholder="请输入手机号" left-icon="phone" />
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="pwd" type="password" label="密码" placeholder="请输入密码" left-icon="home-o" />
			</van-cell-group>
			<van-cell-group>
				<van-cell @click="wjmm" title="" url="" value="忘记密码?">
				
				</van-cell>
				<van-cell @click="getLogin">
					<van-button size="large" type="danger">立即登录</van-button>
				</van-cell>
				<van-cell>
					<van-button size="large" @click="zhuce" hairline>还没注册？立即注册</van-button>
				</van-cell>
			</van-cell-group>
		</div>
		<script>
			var vm = new Vue({
				el: "#app",
				data: {
						phone:"",
						pwd:"",
				},
				methods:{
					getLogin:function(){
						var _this = this;
						ajax({
							url: "http://dsapi.ysd3g.com/api/login",
							data:{account:_this.phone,password:_this.pwd},
							dataType: "jsonp",
							success: function(res) {
								if(!res.Error){
									_this.$toast("验证成功");
									localStorage.setItem("userData", JSON.stringify(res.UserData))
									localStorage.setItem("imgUrl",res.UserData.imgUrl)
									localStorage.setItem("NickName",res.UserData.NickName);
									localStorage.setItem("Phone",res.UserData.Phone);
									localStorage.setItem("CityName",res.UserData.CityName);
									localStorage.setItem("key",res.Key);
									localStorage.setItem("pwd",res.UserData.pwd);
									setTimeout(function (){
										var w=plus.webview.currentWebview();
										var c=plus.webview.getWebviewById("setas");
										c.reload(true);
										w.close();
									},200)
									
								}
								else{
									_this.Msg=res.Msg;
									_this.$toast(_this.Msg);
								}
							}
						})
						
					},
					onback1:function(){
						plus.webview.hide(plus.webview.currentWebview());
					},
					zhuce:function(){
						plus.webview.create("JAUser-log-on.html","JAUser").show()
					},
					wjmm:function(){
						plus.webview.create("JAset up.html","JAset up").show()
					}
				}
			})
		</script>
	</body>
</html>